home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 April / macformat-023.iso / Shareware City / Developers / NeoPersist 3.0.8 folder / NeoIncludes / Macintosh / PowerPlant / NeoPowerPlant.h < prev   
Encoding:
C/C++ Source or Header  |  1994-10-13  |  4.1 KB  |  149 lines  |  [TEXT/KAHL]

  1. /************************************************************
  2.  *
  3.  *    Created: Thursday, December 3, 1992 12:01:00 PM
  4.  *    NeoPP.h
  5.  *    PowerPlant -specific definitions for NeoLogic products
  6.  *
  7.  *    Copyright © Neologic Systems 1992-1993. All Rights Reserved.
  8.  *    All rights reserved
  9.  *
  10.  ***********************************************************/
  11. #pragma once            /* Include this file only once */
  12.  
  13. #ifdef qNeoDebug
  14. #define        DEBUG_On            1
  15. #endif
  16.  
  17. #define qPowerPlant                1
  18. #include "PP_Types.h"
  19.  
  20. #define qNeoPtrBased            1
  21.  
  22. #define CNeoAppBaseH            "LDocApplication.h"
  23. class                            LDocApplication;
  24. #define CNeoAppBase                LDocApplication
  25. #define CNeoAppPPH                "CNeoAppPP.h"
  26. #define CNeoAppNativeH            CNeoAppPPH
  27. class                            CNeoAppPP;
  28. #define CNeoAppNative            CNeoAppPP
  29.  
  30. class                            LSingleDoc;
  31. #define CNeoDocBase                LSingleDoc
  32. #define CNeoDocBaseH            "LSingleDoc.h"
  33. #define CNeoDocPPH                "CNeoDocPP.h"
  34. #define CNeoDocNativeH            CNeoDocPPH
  35. class                            CNeoDocPP;
  36. #define CNeoDocNative            CNeoDocPP
  37.  
  38. #define CNeoPersistNativeH        CNeoPersistH
  39. class                            CNeoPersist;
  40. #define CNeoObject                CNeoPersist
  41. #define CNeoPersistNative        CNeoPersist
  42.  
  43. #define CNeoDatabaseBaseH        "LFile.h"
  44. class                            LFile;
  45. #define CNeoDatabaseBase        LFile
  46. #define CNeoDatabasePPH            "CNeoDatabasePP.h"
  47. #define CNeoDatabaseNativeH        CNeoDatabasePPH
  48. class                            CNeoDatabasePP;
  49. #define CNeoDatabaseNative        CNeoDatabasePP
  50.  
  51. #define kNeoWaitForever            -1
  52.  
  53. #define CNeoIteratorNativeH        CNeoIteratorH
  54. class                            CNeoIterator;
  55. #define CNeoIteratorNative        CNeoIterator
  56.  
  57. #include "LPeriodical.h"
  58.  
  59. class CNeoChore : public LPeriodical
  60. {
  61. public:
  62.     virtual void    Perform(long *aMaxSleep);
  63.     virtual    void    SpendTime(const EventRecord &aEvent);
  64. };
  65.  
  66. class                            LList;
  67. typedef LList                    CNeoArray;
  68.  
  69. class LWindow;
  70. typedef LWindow                    CNeoWindowBase;
  71. #define CNeoWindowBaseH            "LWindow.h"
  72.  
  73. #define gNeoApp                    CNeoAppPP::FApplication
  74. #define cmdRemoteOpen            1025
  75.  
  76. // Macro for manipulating a CNeoArray
  77. #define NeoArrayAddObj(a, o)    ((CNeoArray *)(a))->InsertItemsAt(1, 0x7FFFFFFF, &(o))
  78. #define NeoArrayCount(a)        (a)->GetCount()
  79. #define NeoArrayCreate(a)        (a) = new CNeoArray
  80. #define NeoArrayDispose(a)        delete (a)
  81. #define NeoArrayGetObj(a, i, o)    ((CNeoArray *)(a))->FetchItemAt((i), &(o))
  82.  
  83. // Macro for manipulating a window object
  84. #define NeoGetWinGrafPort(w)    (w)->GetMacPort()
  85. #define NeoGetWinTitle(w, s)    (w)->GetDescriptor(s)
  86.  
  87. // Macro for document object of a window object
  88. #define NeoWin2Doc(w)            CNeoDocPP::FindByWindow(w)
  89.  
  90. // Macro for adding a chore to the applications chore list
  91. #define NeoAddChore(c)            (c)->StartIdling();
  92. #define NeoAddIdleChore(c)        (c)->StartIdling();
  93. #define NeoRemoveChore(c)        (c)->StopIdling();
  94. #define NeoMaxSleep                10
  95.  
  96. enum {
  97.     NeoAppNeedMemory    = 50,
  98.     NeoDirtyBase        = 60,
  99.     NeoAddObject        = 61,
  100.     NeoChangeObject        = 62,
  101.     NeoDeleteObject        = 63
  102. };
  103.  
  104. #include <UException.h>
  105.  
  106. #define NEOTRY                                                    \
  107.     {    Boolean Neopropagate = 1;                                \
  108.         UException    _TryObject;                                    \
  109.         _TryObject.mError = 0;                                    \
  110.         _TryObject.mNextHandler = UException::sFirstHandler;    \
  111.         UException::sFirstHandler = &_TryObject;                \
  112.         if (setjmp(_TryObject.mSaveBuffer) == 0) {
  113.  
  114. #define NEOCATCH        Catch_(NeoLastError)                    \
  115.         if (Neopropagate)                                        \
  116.             Throw(NeoLastError);                                \
  117.  
  118. #define NEOENDTRY        EndCatch_
  119.  
  120. // Macros for handling failures
  121. #define NEOTRYTO                                                \
  122.     {    Boolean Neopropagate = 1;                                \
  123.         int __result;                                            \
  124.         UException    _TryObject;                                    \
  125.         _TryObject.mError = 0;                                    \
  126.         _TryObject.mNextHandler = UException::sFirstHandler;    \
  127.         UException::sFirstHandler = &_TryObject;                \
  128.         __result = setjmp(_TryObject.mSaveBuffer);                \
  129.         if (!__result) {    
  130.         
  131. #define NEOCLEANUP                                                \
  132.         }                                                        \
  133.         ExceptionCode    NeoLastError = _TryObject.mError;        \
  134.         UException::sFirstHandler = _TryObject.mNextHandler;
  135.  
  136. #define NEOENDTRYTO                                                \
  137.         if (__result && Neopropagate)                            \
  138.             Throw(NeoLastError);                                \
  139.     }
  140.  
  141. #define TRYTO                                NEOTRYTO
  142. #define CLEANUP                                NEOCLEANUP
  143. #define ENDTRYTO                            NEOENDTRYTO
  144. #define FailOSErr(err)                        ThrowIfOSErr_(err)
  145. #define FailNIL(x)                            ThrowIfNil_(x)
  146.  
  147. #define NeoPropagateFailure(x)                Neopropagate = (x)
  148. #define NeoFailErr()                        NeoLastError
  149.